package com.east.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Random;

import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;


public class ObjectUtil {
		public static boolean beanbjList(List<Integer> list,Integer value) {
			for (Integer integer : list) {
				if(value.equals(integer)) {
					return true;
				}
			}
			return false;
			
		}
		/**
		      * 汉字转为拼音
		      * @param chinese
		      * @return
		      */
		     public static String ToPinyin(String chinese){          
		         String pinyinStr = "";  
		         char[] newChar = chinese.toCharArray();  
		         HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();  
		         defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);  
		         defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);  
		         for (int i = 0; i < newChar.length; i++) {  
		             if (newChar[i] > 128) {  
		                 try {  
		                     pinyinStr += PinyinHelper.toHanyuPinyinStringArray(newChar[i], defaultFormat)[0];  
		                 } catch (BadHanyuPinyinOutputFormatCombination e) {  
		                     e.printStackTrace();  
		                 }  
		             }else{  
		                 pinyinStr += newChar[i];  
		             }  
		         }  
		         return pinyinStr;  
		     }  
		     public static void main(String[] args) {
		    	 System.out.println(serNum());
			}
		     
		   public static String  serNum() {
			   SimpleDateFormat simpleDateFormat;
			   
				simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
		 
				Date date = new Date();
		 
				String str = simpleDateFormat.format(date);
		 
				Random random = new Random();
		 
				int rannum = (int) (random.nextDouble() * (99999 - 10000 + 1)) + 10000;// 获取5位随机数
				return str+rannum;
		   }
}
